package com.example.makerspace.controller.points;



import com.example.makerspace.domain.TaskTagDO;
import com.example.makerspace.dto.Result;
import com.example.makerspace.dto.TaskTagDTO;
import com.example.makerspace.service.PointBreakdownService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

@Controller
@ResponseBody
@RequestMapping("/api/point")
@Api(tags = "积分模块")
public class PointsController {

    @Resource
    private PointBreakdownService pointBreakdownService;

    @ApiOperation(value="签到接口",notes ="签到接口说明")
    @GetMapping("/signIn")
    public Result addBulletins(HttpServletRequest request){
        return  pointBreakdownService.signIn(request);
    }

    @ApiOperation(value="获取积分明细接口",notes ="获取积分明细接口说明")
    @GetMapping("/getPointsBreakdown")
    public  Result getPointsBreakdown(HttpServletRequest request){
        return  pointBreakdownService.getPointsBreakdown(request);
    }

    @ApiOperation(value="获取任务列表接口",notes ="获取任务列表接口说明")
    @GetMapping("/getIntegralTasks")
    public  Result getIntegralTasks(HttpServletRequest request){
        return  pointBreakdownService.getIntegralTasks(request);
    }
    @ApiOperation(value="获取是否为同一天接口",notes ="获取是否为同一天接口说明")
    @GetMapping("/getIfSameDay")
    public  Result getIfSameDay(HttpServletRequest request){
        return  pointBreakdownService.getIfSameDay(request);
    }
    @ApiOperation(value="获取签到数据接口",notes ="获取积分明细接口说明")
    @GetMapping("/getSignIn")
    public  Result getSignIn(HttpServletRequest request){
        return  pointBreakdownService.getSignIn(request);
    }


    @ApiOperation(value="后台-增加任务标签接口",notes ="后台-增加任务标签接口说明")
    @PostMapping("/addTaskTag")
    public  Result addTaskTag(@RequestBody TaskTagDTO taskTagDTO){
        return  pointBreakdownService.addTaskTag(taskTagDTO);
    }


    @PostMapping("/get")
    public  Result get(){
        return  pointBreakdownService.get();
    }


    @ApiOperation(value="后台-获取任务标签接口",notes ="后台-获取任务标签接口说明")
    @GetMapping("/getTaskTag")
    public  Result getTaskTag(){
        return  pointBreakdownService.getTaskTag();
    }

    @ApiOperation(value="后台-更新任务标签接口",notes ="后台-获取任务标签接口说明")
    @PostMapping("/updateTaskTag")
    public  Result updateTaskTag(@RequestBody  TaskTagDTO  taskTagDTO){
        return  pointBreakdownService.updateTaskTag(taskTagDTO);
    }

    @ApiOperation(value="后台-删除任务标签接口",notes ="后台-获取任务标签接口说明")
    @GetMapping("/deleteTaskTag")
    public  Result deleteTaskTag(@RequestParam("id")Integer id){
        return  pointBreakdownService.deleteTaskTag(id);
    }

}
